﻿using IDAL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace IBLL
{
    /*定义公共方法*/
    public interface IBaseService<T> where T:class,new()
    {
        /*IDALsession DBsession{get;}
        IBaseDAL<T> Dal { get; set; }*/
        /// <summary>
        /// 查询数据
        /// </summary>
        /// <param name="whereLambda">查询条件</param>
        /// <returns></returns>
        IQueryable<T> LoadData(Expression<Func<T, bool>> whereLambda);
        /// <summary>
        /// 分页查询
        /// </summary>
        /// <typeparam name="c">排序类型</typeparam>
        /// <param name="pageIndex">当前页</param>
        /// <param name="pageSize">每页显示条数</param>
        /// <param name="totalCount">总记录数</param>
        /// <param name="whereLambda">查询条件</param>
        /// <param name="orderbyLambda">排序条件</param>
        /// <param name="isAsc">是否倒序</param>
        /// <returns></returns>
        IQueryable<T> Paging<c>(int pageIndex, int pageSize, out int totalCount, System.Linq.Expressions.Expression<Func<T, bool>> whereLambda, System.Linq.Expressions.Expression<Func<T, c>> orderbyLambda, bool isAsc);
        /// <summary>
        /// 删除数据
        /// </summary>
        /// <param name="entity">实体模型</param>
        /// <returns></returns>
        bool DeleteSign(T entity);
        /// <summary>
        /// 编辑数据
        /// </summary>
        /// <param name="entity">实体模型</param>
        /// <returns></returns>
        bool EditSign(T entity);
        /// <summary>
        /// 添加数据
        /// </summary>
        /// <param name="entity">实体模型</param>
        /// <returns>返回添加成功的实体模型</returns>
        T AddSing(T entity);
    }
}
